// 冒泡算法
function app(arr) {
    var length = arr.length;
    for (var i = length - 1; 0 < i; i--) {
        for (var j = 0; j < i; j++) {
            if(arr[j]>arr[j+1]){
                var temp = arr[j];
                arr[j] = arr[j+1];
                arr[j+1] = temp;
            }

        }

    }
    return arr;
}
function ugg(arr) {
    var length = arr.length;
    for (var i = length-1;0<i; i--) {
        for (var j = 0; j < i; j++) {
            if (arr[j] > arr[j + 1]) {
                var temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
    }
    return arr;
}
var arrs = [1,5,6,9,8,7,4,5,6,255,44,566,88,99];
var ss = app(arrs);
console.log(ss);